home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-08-22 | 2.3 KB | 104 lines | [TEXT/MPS ] |
- //
- // ActivateShimAtom.c
- //
- // Demonstration of a format0 action atom and compatibility with
- // Installer Engine 4.1.
- //
- // This action atom is designed to make the USBAddShimToDisk call. USBAddShimToDisk is a
- // new call for USB 1.3.5 which is used to activate a USBShim file long after the startup
- // process. This actionatom is compiled as a native code resource.
- //
- //
-
- // comment the following out to turn off DebugStr
- #define DEBUG 1
-
- #include "AtomDefs.h"
- #include <Types.h>
- #include <Resources.h>
- #include <Files.h>
- #include <Folders.h>
- #include <TextUtils.h>
- #include <MixedMode.h>
- #include <USB.h>
-
- // this line replaces #include "ActionAtomHeader.h" used in previous 4.0.3 action atoms
- #include "InstallerScript.h"
- ActionAtomResult ActionAtom2Proc( ActionAtom2PBPtr atomRecPtr );
-
- enum {
- uppActionAtom2ProcInfo = kCStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(long)))
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ActionAtom2PBPtr)))
- };
-
- ProcInfoType __procinfo = uppActionAtom2ProcInfo;
-
- ActionAtomResult ActionAtom2Proc( ActionAtom2PBPtr atomRecPtr )
- {
- FSSpec fsspec;
- StringHandle strh;
- short foundRefNum;
- OSStatus status;
- OSErr err;
- Boolean result;
-
- #if DEBUG
- DebugStr("\pEntered ActionAtom2Proc");
- #endif
- // check if we are executing at post install time and return if not
- if (atomRecPtr->fMessageID != after)
- return kActionAtomResultContinue;
-
- // only execute if we are doing a live install
- if (atomRecPtr->fDidLiveUpdate != true)
- return kActionAtomResultContinue;
-
- strh = GetString(kShimSTRid);
- if (strh)
- {
- err = FindFolder(atomRecPtr->fTargetVRefNum, kExtensionFolderType, kDontCreateFolder,
- &fsspec.vRefNum, &fsspec.parID);
- if (err == noErr)
- {
- BlockMove(*strh, &(fsspec.name), (long)(**strh) + 1);
-
- if ((Ptr) USBAddShimFromDisk != (Ptr) kUnresolvedCFragSymbolAddress)
- {
- status = USBAddShimFromDisk(&fsspec);
- if (status != noErr)
- {
- #if DEBUG
- DebugStr("\p call to ActionAtomFormat2::USBAddShimFromDisk failed");
- #endif
- }
- }
- else
- {
- #if DEBUG
- DebugStr("\p cannot see USBAddShimFromDisk");
- #endif
- }
- }
- else
- {
- #if DEBUG
- DebugStr("\p call to ActionAtomFormat2::FindFolder failed");
- #endif
- }
- }
- else
- {
- #if DEBUG
- DebugStr("\p call to ActionAtomFormat2::GetString failed");
- #endif
- }
-
- return (kActionAtomResultContinue);
- }
-
-
-
-
-
-